home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14479 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  887 b 

  1. Path: news1.intercall.com!usenet
  2. From: engevar@intercall.com (Steven Ovits)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Help Please
  5. Date: Sat, 30 Mar 1996 23:30:53 GMT
  6. Organization: Intercall Inc.
  7. Message-ID: <4jk6k5$9s0@news1.intercall.com>
  8. References: <4ji7eo$kgm@daisy.flex.com.au>
  9. NNTP-Posting-Host: ts2-111.intercall.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. cobweb@flex.com.au (Tony L) wrote:
  13.  
  14. >Hi all,
  15.  
  16. >I have this prog that I can't get to do a simple IF condition
  17. >properly.  I just want it to say "You have voted for Paul Keating" if
  18. >the user enters Paul Keating.  Yeah!  I know, stupid idea for a
  19. >program  :-))) 
  20.  
  21. Relevant code follows
  22. >    if (last2 == him)
  23. >        { printf("you have voted for Paul Keating!"); }
  24. >    else
  25. >    { printf("\nYou didn't vote for Paul Keating!");  }
  26.  
  27. C strings are arrays of char.
  28. You can't compare arrays using the == operator.
  29. Use strcmp from the library.
  30.  
  31.  
  32.